package com.dhecp.project.storage.service.impl;

import com.alibaba.fastjson.JSON;
import com.dhecp.core.utils.PageUtils;
import com.dhecp.project.storage.domain.HwTailprogramdetail;
import com.dhecp.project.storage.domain.HwTailprogramdetailTol;
import com.dhecp.project.storage.mapper.HwTailprogramdetailMapper;
import com.dhecp.project.storage.service.HwTailprogramdetailService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.dhecp.core.constant.DataFiltering;
import com.dhecp.project.system.service.SysDictionaryForFieldService;

import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 头程计划装箱详情(HwTailprogramdetail表)服务实现类
 *
 * @author fxz
 * @since 2023-09-08 10:09:03
 */
@Service("hwTailprogramdetailService")
public class HwTailprogramdetailServiceImpl implements HwTailprogramdetailService {
    @Autowired
    private 
    HwTailprogramdetailMapper hwTailprogramdetailMapper;
    
    @Autowired
    private SysDictionaryForFieldService dictionaryForFieldService;


    /**
     * 查询头程计划单
     * @param params
     * @return
     * @throws Exception
     */
    @Override
    public List<HwTailprogramdetail> queryList(Map<String, Object> params) throws Exception {
        params.put(DataFiltering.TABLE_ALIAS, "t1");	//查询表别名
        params.put(DataFiltering.DATA_WHERE, dictionaryForFieldService.getWhereStr(params));	//常规查询条件SQL语句
        params.put(DataFiltering.DATA_SCODE, dictionaryForFieldService.getDataScode(params));	//数据权限查询条件SQL语句

        if (params.get("field") == null || params.get("field") == ""){
            String orderBy = "code asc";
            PageUtils.startPageOrder(orderBy);
        }else{
            PageUtils.startPage();
        }
        //获取当前装箱单有多少头程订单
        List<HwTailprogramdetail> queryList = new ArrayList<>();
        //头程计划单下所有箱子数据
        List<HwTailprogramdetail> hwTailprogramdetailList = hwTailprogramdetailMapper.findHwTailprogramdetail(params);

        //hwTailprogramdetailList为空新增  反之修改
        List<HwTailprogramdetail> hwTailprogramdetailNew = null;
        String numRealityDeliver;
        String numRealityDeliver1;
        //总的数量值
        HwTailprogramdetailTol hwTailprogramdetailTol = new HwTailprogramdetailTol();
        if (hwTailprogramdetailList.size() > 0){
            //取出每条箱子的商品数据将箱数赋值到对应的箱子数据上
            for (int j = 0; j < hwTailprogramdetailList.size(); j++) {
                hwTailprogramdetailNew = JSON.parseArray(hwTailprogramdetailList.get(j).getProductinfo(), HwTailprogramdetail.class);
                for (int i = 0; i < hwTailprogramdetailNew.size(); i++) {
                    if (j == 0) {
                        switch (j) {
                            case 0:
                                hwTailprogramdetailNew.get(i).setNumRealityDeliver1(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 1:
                                hwTailprogramdetailNew.get(i).setNumRealityDeliver2(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 2:
                                hwTailprogramdetailNew.get(i).setNumRealityDeliver3(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 3:
                                hwTailprogramdetailNew.get(i).setNumRealityDeliver4(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 4:
                                hwTailprogramdetailNew.get(i).setNumRealityDeliver5(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 5:
                                hwTailprogramdetailNew.get(i).setNumRealityDeliver6(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 6:
                                hwTailprogramdetailNew.get(i).setNumRealityDeliver7(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 7:
                                hwTailprogramdetailNew.get(i).setNumRealityDeliver8(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 8:
                                hwTailprogramdetailNew.get(i).setNumRealityDeliver9(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 9:
                                hwTailprogramdetailNew.get(i).setNumRealityDeliver10(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                        }
                    } else {
                        numRealityDeliver = hwTailprogramdetailNew.get(i).getNumRealityDeliver().equals("")?"0":hwTailprogramdetailNew.get(i).getNumRealityDeliver();
                        numRealityDeliver1 = queryList.get(i).getNumRealityDeliver().equals("")?"0":queryList.get(i).getNumRealityDeliver();
                        queryList.get(i).setNumRealityDeliver(
                                String.valueOf(new Integer(numRealityDeliver1)
                                        + new Integer(numRealityDeliver)));
                        switch (j) {
                            case 1:
                                queryList.get(i).setNumRealityDeliver2(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 2:
                                queryList.get(i).setNumRealityDeliver3(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 3:
                                queryList.get(i).setNumRealityDeliver4(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 4:
                                queryList.get(i).setNumRealityDeliver5(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 5:
                                queryList.get(i).setNumRealityDeliver6(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 6:
                                queryList.get(i).setNumRealityDeliver7(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 7:
                                queryList.get(i).setNumRealityDeliver8(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 8:
                                queryList.get(i).setNumRealityDeliver9(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                            case 9:
                                queryList.get(i).setNumRealityDeliver10(hwTailprogramdetailNew.get(i).getNumRealityDeliver());
                                break;
                        }
                    }
                    if (j == 0) {
                        queryList.add(hwTailprogramdetailNew.get(i));
                    }
                }
            }

            //进行排序（naturalOrder 正序）（reverseOrder倒叙）
            queryList = queryList.stream().
                    sorted(Comparator.comparing(HwTailprogramdetail::getCommodityCode, Comparator.naturalOrder())).
                    sorted(Comparator.comparing(HwTailprogramdetail::getCodeStockLocation, Comparator.naturalOrder())).
                    sorted(Comparator.comparing(HwTailprogramdetail::getCodeStockArea, Comparator.naturalOrder())).
                    sorted(Comparator.comparing(HwTailprogramdetail::getCodeStockOn, Comparator.naturalOrder())).
                    collect(Collectors.toList());
        }

        //合计栏数据
        for (HwTailprogramdetail hwTailprogramdetail : queryList){
            hwTailprogramdetailTol.setNumPlanDeliver(String.valueOf(new Integer(hwTailprogramdetailTol.getNumPlanDeliver()) + new Integer(hwTailprogramdetail.getNumPlanDeliver())));
            hwTailprogramdetailTol.setNumRealityDeliver(String.valueOf(new Integer(hwTailprogramdetailTol.getNumRealityDeliver()) + (hwTailprogramdetail.getNumRealityDeliver().equals("")?0:new Integer(hwTailprogramdetail.getNumRealityDeliver()))));
            hwTailprogramdetailTol.setNumRealityDeliver1(String.valueOf(new Integer(hwTailprogramdetailTol.getNumRealityDeliver1()) + (hwTailprogramdetail.getNumRealityDeliver1().equals("")?0:new Integer(hwTailprogramdetail.getNumRealityDeliver1()))));
            hwTailprogramdetailTol.setNumRealityDeliver2(String.valueOf(new Integer(hwTailprogramdetailTol.getNumRealityDeliver2()) + (hwTailprogramdetail.getNumRealityDeliver2().equals("")?0:new Integer(hwTailprogramdetail.getNumRealityDeliver2()))));
            hwTailprogramdetailTol.setNumRealityDeliver3(String.valueOf(new Integer(hwTailprogramdetailTol.getNumRealityDeliver3()) + (hwTailprogramdetail.getNumRealityDeliver3().equals("")?0:new Integer(hwTailprogramdetail.getNumRealityDeliver3()))));
            hwTailprogramdetailTol.setNumRealityDeliver4(String.valueOf(new Integer(hwTailprogramdetailTol.getNumRealityDeliver4()) + (hwTailprogramdetail.getNumRealityDeliver4().equals("")?0:new Integer(hwTailprogramdetail.getNumRealityDeliver4()))));
            hwTailprogramdetailTol.setNumRealityDeliver5(String.valueOf(new Integer(hwTailprogramdetailTol.getNumRealityDeliver5()) + (hwTailprogramdetail.getNumRealityDeliver5().equals("")?0:new Integer(hwTailprogramdetail.getNumRealityDeliver5()))));
            hwTailprogramdetailTol.setNumRealityDeliver6(String.valueOf(new Integer(hwTailprogramdetailTol.getNumRealityDeliver6()) + (hwTailprogramdetail.getNumRealityDeliver6().equals("")?0:new Integer(hwTailprogramdetail.getNumRealityDeliver6()))));
            hwTailprogramdetailTol.setNumRealityDeliver7(String.valueOf(new Integer(hwTailprogramdetailTol.getNumRealityDeliver7()) + (hwTailprogramdetail.getNumRealityDeliver7().equals("")?0:new Integer(hwTailprogramdetail.getNumRealityDeliver7()))));
            hwTailprogramdetailTol.setNumRealityDeliver8(String.valueOf(new Integer(hwTailprogramdetailTol.getNumRealityDeliver8()) + (hwTailprogramdetail.getNumRealityDeliver8().equals("")?0:new Integer(hwTailprogramdetail.getNumRealityDeliver8()))));
            hwTailprogramdetailTol.setNumRealityDeliver9(String.valueOf(new Integer(hwTailprogramdetailTol.getNumRealityDeliver9()) + (hwTailprogramdetail.getNumRealityDeliver9().equals("")?0:new Integer(hwTailprogramdetail.getNumRealityDeliver9()))));
            hwTailprogramdetailTol.setNumRealityDeliver10(String.valueOf(new Integer(hwTailprogramdetailTol.getNumRealityDeliver10()) + (hwTailprogramdetail.getNumRealityDeliver10().equals("")?0:new Integer(hwTailprogramdetail.getNumRealityDeliver10()))));
        }

        HwTailprogramdetail hwTailprogramdetail;
        String serial = "";
        for (int i = 0; i < 8; i++) {
            hwTailprogramdetail = new HwTailprogramdetail();
            switch (i) {
                case 0:
                    serial = "合计";
                    break;
                case 1:
                    serial = "箱重(kg)";
                    break;
                case 2:
                    serial = "箱规长(cm)";
                    break;
                case 3:
                    serial = "箱规宽(cm)";
                    break;
                case 4:
                    serial = "箱规高(cm)";
                    break;
                case 5:
                    serial = "抛重(kg)";
                    break;
                case 6:
                    serial = "单箱采购总价(￥)";
                    break;
                case 7:
                    serial = "追踪编号";
                    break;
            }
            //添加箱重/长宽高等数据
            addJx(hwTailprogramdetailList,hwTailprogramdetail,i,hwTailprogramdetailTol);

            hwTailprogramdetail.setScrapData("1");
            hwTailprogramdetail.setSerial(serial);
            queryList.add(hwTailprogramdetail);
        }
        return queryList;
    }

    /**
     * 查询头程计划单
     * @param params
     * @return
     * @throws Exception
     */
    @Override
    public List<HwTailprogramdetail> queryAutoList(Map<String, Object> params) throws Exception {
        params.put(DataFiltering.TABLE_ALIAS, "t1");	//查询表别名
        params.put(DataFiltering.DATA_WHERE, dictionaryForFieldService.getWhereStr(params));	//常规查询条件SQL语句
        params.put(DataFiltering.DATA_SCODE, dictionaryForFieldService.getDataScode(params));	//数据权限查询条件SQL语句

        if (params.get("field") == null || params.get("field") == ""){
            String orderBy = "code asc";
            PageUtils.startPageOrder(orderBy);
        }else{
            PageUtils.startPage();
        }
        //获取当前装箱单有多少头程订单
        List<HwTailprogramdetail> queryList = new ArrayList<>();
        //头程计划单下所有箱子数据
        List<HwTailprogramdetail> hwTailprogramdetailList = hwTailprogramdetailMapper.findHwTailprogramdetail(params);

        //hwTailprogramdetailList为空新增  反之修改
        List<HwTailprogramdetail> hwTailprogramdetailNew = null;
        String numRealityDeliver;
        String numRealityDeliver1;
        //总的数量值
        HwTailprogramdetailTol hwTailprogramdetailTol = new HwTailprogramdetailTol();
        Map<String,List<BigDecimal>> boxListMap = new HashMap<>();
        List<BigDecimal> boxList;
        List<BigDecimal> boxListTol;
        List<String> zzbh = new ArrayList<>();


        if (hwTailprogramdetailList.size() > 0){
            //取出每条箱子的商品数据将箱数赋值到对应的箱子数据上
            for (int j = 0; j < hwTailprogramdetailList.size(); j++) {
                hwTailprogramdetailNew = JSON.parseArray(hwTailprogramdetailList.get(j).getProductinfo(), HwTailprogramdetail.class);
                for (int i = 0; i < hwTailprogramdetailNew.size(); i++) {
                    boxList = new LinkedList<>();
                    numRealityDeliver = hwTailprogramdetailNew.get(i).getNumRealityDeliver().equals("") ? "0" : hwTailprogramdetailNew.get(i).getNumRealityDeliver();
                    if (j != 0) {
                        //计算商品的计划数量和实际数量
                        numRealityDeliver1 = queryList.get(i).getNumRealityDeliver().equals("")?"0":queryList.get(i).getNumRealityDeliver();
                        queryList.get(i).setNumRealityDeliver(
                                String.valueOf(new Integer(numRealityDeliver1)
                                        + new Integer(numRealityDeliver)));
                    }
                    //将每个商品的箱子数据按照数组形式存储起来
                    if (boxListMap.get(hwTailprogramdetailNew.get(i).getSerial()) == null) {
                        boxList.add(new BigDecimal(numRealityDeliver));
                        boxListMap.put(hwTailprogramdetailNew.get(i).getSerial(), boxList);
                    } else {
                        boxList = boxListMap.get(hwTailprogramdetailNew.get(i).getSerial());
                        if (hwTailprogramdetailNew.get(i).getNumRealityDeliver().equals("")) {
                            boxList.add(BigDecimal.ZERO);
                        } else {
                            boxList.add(new BigDecimal(hwTailprogramdetailNew.get(i).getNumRealityDeliver()));
                        }
                        boxListMap.put(hwTailprogramdetailNew.get(i).getSerial(), boxList);
                    }
                    if (j == 0) {
                        hwTailprogramdetailNew.get(i).setBoxList("");
                        queryList.add(hwTailprogramdetailNew.get(i));
                    }
                }

                //箱重-追踪编号的每箱的数据设置进数组中
                String serial = "";
                String val = "";
                for (int i = 1; i < 8; i++) {
                    boxListTol = new LinkedList<>();
                    switch (i) {
                        case 1:
                            boxListTol.add(new BigDecimal(hwTailprogramdetailList.get(j).getWeight()));
                            val = hwTailprogramdetailList.get(j).getWeight();
                            serial = "箱重(kg)";
                            break;
                        case 2:
                            serial = "箱规长(cm)";
                            boxListTol.add(new BigDecimal(hwTailprogramdetailList.get(j).getLength()));
                            val = hwTailprogramdetailList.get(j).getLength();
                            break;
                        case 3:
                            serial = "箱规宽(cm)";
                            boxListTol.add(new BigDecimal(hwTailprogramdetailList.get(j).getWidth()));
                            val = hwTailprogramdetailList.get(j).getWidth();
                            break;
                        case 4:
                            serial = "箱规高(cm)";
                            boxListTol.add(new BigDecimal(hwTailprogramdetailList.get(j).getHeight()));
                            val = hwTailprogramdetailList.get(j).getHeight();
                            break;
                        case 5:
                            serial = "抛重(kg)";
                            boxListTol.add(new BigDecimal(hwTailprogramdetailList.get(j).getWeightvol()));
                            val = hwTailprogramdetailList.get(j).getWeightvol();
                            break;
                        case 6:
                            serial = "单箱采购总价(￥)";
                            boxListTol.add(BigDecimal.valueOf(hwTailprogramdetailList.get(j).getPricesingleboxreq()));
                            val = String.valueOf(hwTailprogramdetailList.get(j).getPricesingleboxreq());
                            break;
                        case 7:
                            serial = "追踪编号";
                            if (hwTailprogramdetailList.get(j).getTrackingcode() == null){
                                val = "0";
                                zzbh.add("0");
                            }else {
                                val = hwTailprogramdetailList.get(j).getTrackingcode();
                                zzbh.add(hwTailprogramdetailList.get(j).getTrackingcode());
                            }
                            break;
                    }
                    if (j == 0) {
                        boxListMap.put(serial, boxListTol);
                    } else {
                        boxListTol = boxListMap.get(serial);
                        if (val.equals("")) {
                            boxListTol.add(BigDecimal.ZERO);
                            zzbh.add("0");
                        } else {
                            if (!serial.equals("追踪编号")){
                                boxListTol.add(new BigDecimal(val));
                            }
                        }
                        boxListMap.put(serial, boxListTol);
                    }
                }
            }

            //进行排序（naturalOrder 正序）（reverseOrder倒叙）
            queryList = queryList.stream().
                    sorted(Comparator.comparing(HwTailprogramdetail::getCommodityCode, Comparator.naturalOrder())).
                    sorted(Comparator.comparing(HwTailprogramdetail::getCodeStockLocation, Comparator.naturalOrder())).
                    sorted(Comparator.comparing(HwTailprogramdetail::getCodeStockArea, Comparator.naturalOrder())).
                    sorted(Comparator.comparing(HwTailprogramdetail::getCodeStockOn, Comparator.naturalOrder())).
                    collect(Collectors.toList());

            Map<String,BigDecimal> boxListMapTol = new HashMap<>();
            //合计栏数据
            for (HwTailprogramdetail hwTailprogramdetail : queryList){
                hwTailprogramdetail.setBoxList(boxListMap.get(hwTailprogramdetail.getSerial()).toString());
                hwTailprogramdetailTol.setNumPlanDeliver(String.valueOf(new Integer(hwTailprogramdetailTol.getNumPlanDeliver()) + new Integer(hwTailprogramdetail.getNumPlanDeliver())));
                hwTailprogramdetailTol.setNumRealityDeliver(String.valueOf(new Integer(hwTailprogramdetailTol.getNumRealityDeliver()) + (hwTailprogramdetail.getNumRealityDeliver().equals("")?0:new Integer(hwTailprogramdetail.getNumRealityDeliver()))));
                for (int i = 0; i < boxListMap.get(hwTailprogramdetail.getSerial()).size(); i++) {
                    if (boxListMapTol.get(String.valueOf(i)) == null){
                        boxListMapTol.put(String.valueOf(i),boxListMap.get(hwTailprogramdetail.getSerial()).get(i));
                    }else {
                        if (boxListMapTol.get(String.valueOf(i)).equals("")){
                            boxListMapTol.put(String.valueOf(i),BigDecimal.ZERO);
                        }else {
                            boxListMapTol.put(String.valueOf(i),boxListMapTol.get(String.valueOf(i)).add(boxListMap.get(hwTailprogramdetail.getSerial()).get(i)));
                        }
                    }
                }
            }

            //设置合计数据
            boxList = new LinkedList<>();
            for(Map.Entry entry : boxListMapTol.entrySet()){
                boxList.add((BigDecimal) entry.getValue());
            }
            hwTailprogramdetailTol.setBoxList(boxList.toString());
        }



        HwTailprogramdetail hwTailprogramdetail;


        String serial = "";
        for (int i = 0; i < 8; i++) {
            hwTailprogramdetail = new HwTailprogramdetail();
            switch (i) {
                case 0:
                    serial = "合计";
                    break;
                case 1:
                    serial = "箱重(kg)";
                    break;
                case 2:
                    serial = "箱规长(cm)";
                    break;
                case 3:
                    serial = "箱规宽(cm)";
                    break;
                case 4:
                    serial = "箱规高(cm)";
                    break;
                case 5:
                    serial = "抛重(kg)";
                    break;
                case 6:
                    serial = "单箱采购总价(￥)";
                    break;
                case 7:
                    serial = "追踪编号";
                    break;
            }
            if (i != 0){
                if (i == 7){
                    hwTailprogramdetail.setBoxList(zzbh==null?null:zzbh.toString());
                }else {
                    hwTailprogramdetail.setBoxList(boxListMap.get(serial)==null?null:boxListMap.get(serial).toString());
                }
            }
            if (i == 0){
                hwTailprogramdetail.setNumPlanDeliver(hwTailprogramdetailTol.getNumPlanDeliver());
                hwTailprogramdetail.setNumRealityDeliver(hwTailprogramdetailTol.getNumRealityDeliver().equals("0")?"":hwTailprogramdetailTol.getNumRealityDeliver());
                hwTailprogramdetail.setBoxList(hwTailprogramdetailTol.getBoxList());
            }

            hwTailprogramdetail.setScrapData("1");
            hwTailprogramdetail.setSerial(serial);
            queryList.add(hwTailprogramdetail);
        }
        return queryList;
    }

    private void  addJx(List<HwTailprogramdetail> hwTailprogramdetailList,HwTailprogramdetail hwTailprogramdetail,Integer type,HwTailprogramdetailTol hwTailprogramdetailTol){
        String valueNum = "";
        for (int j = 0; j < hwTailprogramdetailList.size(); j++) {
            if (type == -1){
                valueNum = hwTailprogramdetail.getNumRealityDeliver();
            }  else if (type == 1){
                valueNum = hwTailprogramdetailList.get(j).getWeight();
            } else  if (type == 2){
                valueNum = hwTailprogramdetailList.get(j).getLength();
            }  else  if (type == 3){
                valueNum = hwTailprogramdetailList.get(j).getWidth();
            } else  if (type == 4){
                valueNum = hwTailprogramdetailList.get(j).getHeight();
            } else  if (type == 5){
                valueNum = hwTailprogramdetailList.get(j).getWeightvol();
            } else  if (type == 6){
                valueNum = String.valueOf(hwTailprogramdetailList.get(j).getPricesingleboxreq());
            }else  if (type == 7){
                valueNum = hwTailprogramdetailList.get(j).getTrackingcode();
            }
            if (type != 0){
                switch (j) {
                    case 0:
                        hwTailprogramdetail.setNumRealityDeliver1(valueNum);
                        break;
                    case 1:
                        hwTailprogramdetail.setNumRealityDeliver2(valueNum);
                        break;
                    case 2:
                        hwTailprogramdetail.setNumRealityDeliver3(valueNum);
                        break;
                    case 3:
                        hwTailprogramdetail.setNumRealityDeliver4(valueNum);
                        break;
                    case 4:
                        hwTailprogramdetail.setNumRealityDeliver5(valueNum);
                        break;
                    case 5:
                        hwTailprogramdetail.setNumRealityDeliver6(valueNum);
                        break;
                    case 6:
                        hwTailprogramdetail.setNumRealityDeliver7(valueNum);
                        break;
                    case 7:
                        hwTailprogramdetail.setNumRealityDeliver8(valueNum);
                        break;
                    case 8:
                        hwTailprogramdetail.setNumRealityDeliver9(valueNum);
                        break;
                    case 9:
                        hwTailprogramdetail.setNumRealityDeliver10(valueNum);
                        break;
                }
            }
        }
        if (type == 0){
            hwTailprogramdetail.setNumPlanDeliver(hwTailprogramdetailTol.getNumPlanDeliver());
            hwTailprogramdetail.setNumRealityDeliver(hwTailprogramdetailTol.getNumRealityDeliver().equals("0")?"":hwTailprogramdetailTol.getNumRealityDeliver());
            hwTailprogramdetail.setNumRealityDeliver1(hwTailprogramdetailTol.getNumRealityDeliver1().equals("0")?"":hwTailprogramdetailTol.getNumRealityDeliver1());
            hwTailprogramdetail.setNumRealityDeliver2(hwTailprogramdetailTol.getNumRealityDeliver2().equals("0")?"":hwTailprogramdetailTol.getNumRealityDeliver2());
            hwTailprogramdetail.setNumRealityDeliver3(hwTailprogramdetailTol.getNumRealityDeliver3().equals("0")?"":hwTailprogramdetailTol.getNumRealityDeliver3());
            hwTailprogramdetail.setNumRealityDeliver4(hwTailprogramdetailTol.getNumRealityDeliver4().equals("0")?"":hwTailprogramdetailTol.getNumRealityDeliver4());
            hwTailprogramdetail.setNumRealityDeliver5(hwTailprogramdetailTol.getNumRealityDeliver5().equals("0")?"":hwTailprogramdetailTol.getNumRealityDeliver5());
            hwTailprogramdetail.setNumRealityDeliver6(hwTailprogramdetailTol.getNumRealityDeliver6().equals("0")?"":hwTailprogramdetailTol.getNumRealityDeliver6());
            hwTailprogramdetail.setNumRealityDeliver7(hwTailprogramdetailTol.getNumRealityDeliver7().equals("0")?"":hwTailprogramdetailTol.getNumRealityDeliver7());
            hwTailprogramdetail.setNumRealityDeliver8(hwTailprogramdetailTol.getNumRealityDeliver8().equals("0")?"":hwTailprogramdetailTol.getNumRealityDeliver8());
            hwTailprogramdetail.setNumRealityDeliver9(hwTailprogramdetailTol.getNumRealityDeliver9().equals("0")?"":hwTailprogramdetailTol.getNumRealityDeliver9());
            hwTailprogramdetail.setNumRealityDeliver10(hwTailprogramdetailTol.getNumRealityDeliver10().equals("0")?"":hwTailprogramdetailTol.getNumRealityDeliver10());
        }
    }
}

